<!-- Halaman Kiri -->        
<div id="menupswt">
    <div id="iconpswt"><img src="<?php echo base_url() ?>image/garuda.png" width="100" /><img src="<?php echo base_url() ?>image/lionair.png" width="100" /><img src="<?php echo base_url() ?>image/sriwijaya.png" width="100" /><img src="<?php echo base_url() ?>image/merpati.png" width="100" /><img src="<?php echo base_url() ?>image/trigana.png" width="100" /><img src="<?php echo base_url() ?>image/kalstar.png" width="100" /></div>
</div>
<div id="infotiket">
    <div id="headertiket">
        <table class="table table-hover table-bordered">
            <thead class="table-head">
                <tr>
                    <td ><strong>Airlines</strong></td>
                    <?php
                    if ($sort == "arrivalasc")
                        $sorta = "arrivaldesc";
                    else
                        $sorta = "arrivalasc";
                    ?>
                    <td><strong>Pergi<a href="<?php echo base_url() ?>costumers/flight/GARUDA.<?php echo $from . '.' . $to . '.' . $date . '.' . $adult_post . '.' . $child_post . '.' . $infant_post . '.' . $sorta ?>"><div id="arrow"><img src="<?php echo base_url() ?>image/updown.png" width="12" height="12"></div></a></strong></td>
                    <td><strong>Tiba</strong></td>
                    <td><strong>Transit</strong></td>
                    <td><strong>Durasi</strong></td>
                    <?php
                    if ($sort == "priceasc")
                        $sorth = "pricedesc";
                    else
                        $sorth = "priceasc";
                    ?>
                    <td><strong>Harga<a href="<?php echo base_url() ?>costumers/flight/GARUDA.<?php echo $from . '.' . $to . '.' . $date . '.' . $adult_post . '.' . $child_post . '.' . $infant_post . '.' . $sorth ?>"><div id="arrow"><img src="<?php echo base_url() ?>image/updown.png" width="12" height="12"></div></a></strong></td>
                </tr>
            </thead>
            <tbody>

                <?php
//                $jsonfile = "https://api.master18.tiket.com/search/flight?d=SMQ&a=SUB&date=2013-01-11&adult=1&child=0&infant=0&ret_date=&token=7b66f67c1b528124c363ad4e36d0f4f9&output=json";
                $jsonfile = "https://api.master18.tiket.com/search/flight?d=" . $from . "&a=" . $to . "&date=" . $date . "&sort=$sort" . "&adult=" . $adult_post . "&child=" . $child_post . "&infant=" . $infant_post . "&ret_date=&token=$token&output=json";
//                $jsonfile = "https://api.master18.tiket.com/flight_api/all_airport?token=7b66f67c1b528124c363ad4e36d0f4f9&output=json";
                $data = json_decode(file_get_contents($jsonfile), true);
                ?>

                <?php if (isset($data['departures'])): ?>
                    <?php $a = $data['departures']['result'] ?>
                    <?php foreach ($a as $key => $value): ?>
                        <?php $search = $data['departures']['result'][$key] ?>
                        <?php echo form_open('costumers/booking') ?>
                        <tr>
                            <td><img src="<?php echo base_url() ?>image/icon_<?php echo strtolower($search['airlines_name']) ?>_2.jpg"/> <?php echo $search['flight_number'] ?></td>
                            <td><?php echo $search['simple_departure_time'] ?></td>
                            <td><?php echo $search['simple_arrival_time'] ?></td>
                            <td><?php echo $search['stop'] ?></td>
                            <td><?php echo $search['duration'] ?></td>
                            <?php
                            echo form_hidden('airlines_name', $search['airlines_name']);
                            echo form_hidden('flight_number', $search['flight_number']);
                            echo form_hidden('price_value', $search['price_value']);
                            echo form_hidden('price_adult', $search['price_adult']);
                            echo form_hidden('price_child', $search['price_child']);
                            echo form_hidden('price_infant', $search['price_infant']);
                            echo form_hidden('simple_departure_time', $search['simple_departure_time']);
                            echo form_hidden('simple_arrival_time', $search['simple_arrival_time']);
                            echo form_hidden('stop', $search['stop']);
                            echo form_hidden('duration', $search['duration']);
                            echo form_hidden('image', $search['image']);

                            echo form_hidden('from', $from);
                            echo form_hidden('to', $to);
                            echo form_hidden('date', $date);
                            echo form_hidden('id_maskapai', $id_maskapai);
                            echo form_hidden('adult', $adult_post);
                            echo form_hidden('child', $child_post);
                            echo form_hidden('infant', $infant_post);
                            ?>
                            <td align="right">
                                <font color="#4F8B2C"><b>IDR <?php echo get_money($search['price_adult']) ?></b></font>

                                <div id="pilih"><?php echo form_submit('submit', 'Pilih', 'class="btn"') ?></div>
                                <br />
                                <font color="black">Per orang</font>
                            </td>
                        </tr>

                        <?php echo form_close() ?>                
                    <?php endforeach ?>
                <?php endif ?>
                <?php foreach ($jadwals as $jadwal): ?>
                    <?php echo form_open('costumers/booking') ?>
                    <tr>
                        <td><img src="<?php echo base_url() ?>image/icon_<?php echo strtolower(get_airlines($jadwal->id_maskapai)) ?>_2.jpg"/> 
                             <?php echo $jadwal->flight ?></td>
                        <td><?php echo $jadwal->depart ?></td>
                        <td><?php echo $jadwal->arrives ?></td>
                        <td></td>
                        <td><?php echo get_durasi($jadwal->depart, $jadwal->arrives) ?></td>

                        <?php
                        echo form_hidden('airlines_name', strtolower(get_airlines($jadwal->id_maskapai)));
                        echo form_hidden('flight_number', $jadwal->flight);
                        echo form_hidden('price_value', 0);
                        echo form_hidden('price_adult', 0);
                        echo form_hidden('price_child', 0);
                        echo form_hidden('price_infant', 0);
                        echo form_hidden('simple_departure_time', $jadwal->depart);
                        echo form_hidden('simple_arrival_time', $jadwal->arrives);
                        echo form_hidden('stop', '');
                        echo form_hidden('duration', '');
                        echo form_hidden('image', '');

                        echo form_hidden('from', $from);
                        echo form_hidden('to', $to);
                        echo form_hidden('date', $date);
                        echo form_hidden('id_maskapai', $id_maskapai);
                        echo form_hidden('adult', $adult_post);
                        echo form_hidden('child', $child_post);
                        echo form_hidden('infant', $infant_post);
                        ?>

                        <td align="right">
                            <font color="#4F8B2C"><b>IDR Request By Admin</b></font>

                            <div id="pilih"><?php echo form_submit('submit', 'Pilih', 'class="btn"') ?></div>
                            <br />
                            <font color="black">Per orang</font>
                        </td>
                    </tr>
                    <?php form_close() ?>
                <?php endforeach ?>
            </tbody>
        </table>



    </div>
</div>
<!-- tutup halaman kiri-->  